<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.nobody.facepk.pojo.SessionUser"%>
<%@page import="com.nobody.facepk.model.Picture"%>
<%@page import="com.nobody.facepk.model.Friends"%>
<%@page import="com.nobody.facepk.sns.Event"%>
<%@page import="com.nobody.facepk.sns.EventType"%>
<%@page import="com.nobody.facepk.model.User"%>
<%@page import="com.nobody.facepk.service.PictureService"%>
<%@page import="com.nobody.facepk.service.ServiceRegistry"%>
<%@page import="com.nobody.facepk.service.UserService"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.List;"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="sheet1.css" media="all"></link>
  <%
  
  SessionUser su = (SessionUser)request.getSession().getAttribute("SESSION_USER");
  User user = (User)request.getAttribute("friendInfo");
  List  pictures = (List)request.getAttribute("pictures");
  int picturesSize = pictures.size();
  
  List myFriends = (List)request.getAttribute("friends");
  
  List  scoringPictures = (List)request.getAttribute("scoringPictures");
  int scoringPicturesSize = scoringPictures.size();
  
  List events = (List)request.getAttribute("events");
  int eventSize = events.size();
 
  PictureService pictureService = ServiceRegistry.getPictureService();
  UserService    userService    = ServiceRegistry.getUserService();
  
  %>
</head>
<body>
<div id="content">
<div id="head">
<div id="temp">
<H1>Face PK</H1>
</div>

<div id="navbar">
<table>
	<tr>
		<td>首页</td>
		<td>个人主页</td>
		<td>相册</td>
		<td>账户</td>
	</tr>
</table>
</div>
</div>

<div id="leftFrame">
 <table>
    	<%=user.getName()%>的好友:<br/>
    	<%
    		for(int i = 0 ; i < myFriends.size() ; i ++){
    		User friend = (User)myFriends.get(i);
    		%>
    			<a href="friendInfo.do?friendId=<%=friend.getId()%>&isMe=false"><%=friend.getName()%></a><br/>
    		<%
    		}
    		
	    	 %>
    	
    </table>


</div>
<div id="rightFrame">
  <table>
    	<%=user.getName()%>当前所有的的照片:<br/>
    	<%
    	if(picturesSize == 0 ){%>
    	暂无图片。
    	<%}else{
    	if(picturesSize>6) picturesSize = 6; //首页最多显示6张
    	for(int i = 0 ; i < picturesSize ; i ++){
    	Picture  pic  = (Picture)pictures.get(i);
    	String picPath = pic.getPath();
    	String picName = pic.getName();
    	String realPath = "pictures/"+pic.getUserId()+"/"+picPath;
    	%>
    	<img src="<%=realPath %>" height="80" width="80"/><a href="grade.do?pictureId=<%=pic.getId() %>">上传</a>
    	
    	<%
           }
    	 }
    	%>
   		<br/><a href="upload.jsp">上传图片</a>
   			 </table>

  <table>
    	<%=user.getName()%>当前可以评分的照片:<br/>
    	<%
    	if(scoringPicturesSize == 0 ){%>
    	暂无图片。
    	<%}else{
    	if(scoringPicturesSize>6) scoringPicturesSize = 6; //首页最多显示6张
    	for(int i = 0 ; i < scoringPicturesSize ; i ++){
    	Picture  pic  = (Picture)scoringPictures.get(i);
    	String picPath = pic.getPath();
    	String picName = pic.getName();
    	String realPath = "pictures/"+pic.getUserId()+"/"+picPath;
    	%>
    	<a href="scorePicture.do?id=<%=pic.getId()%>"><img src="<%=realPath %>" height="80" width="80"/></a>
    	当前评论次数:<%=pic.getScoreCount() %>
    	当前得分:<%=pic.getScore() %><br/>
    	
    	<%
            }
    	 } 
    	%>
   		
   			 </table>


<br/>




</div>
</body>
</html>